HTTP Requests
The following are notes from MDN's articles on HTTP requests.
Compression
- Important way to increase performance of a website
- Lowers bandwidth
- Not a concern of the web developer but rather of the browser and server.
File format compression
- loss-less compression
- lossy compression: jpeg meme
Some formats can be used for both types such as webp. Lossy compression is usually more efficient than loss-less.
Do not double compress (mostly)! ex: do not compress a jpeg, its already a compressed format.
End to end compression
- compress body of message at server and do not decompress until client.
- gzip and br
- Browsers use proactive content negotiation, agent sends accept-encoding, server uses content-encoding.
Compression dictionary transport
modern compression standards can use dictionaries of frequently used data over just using data in the file. Typical for http responses.
Hop by hop compression
Similar to end to end compression. Difference is compression doesn't happen at resource server but rather in any of the nodes on the way to the client. See TE header and transfer encoding
In practice this is a transparent thing for the server and client, its rarely used. Mostly used when sending responses in chunks. Typically happens at proxy level (cloudflare?)
